import Vue from 'vue'
import Home from '@/components/Home'
import News from '@/components/News'
import TiYu from '@/components/TiYu'
import GuoNei from '@/components/views/GuoNei'
import WaiGuo from '@/components/views/WaiGuo'
import TiZhu from '@/components/views/TiZhu'

// 作业二
import UiRouter from '@/components/UiRouter'
import Contact from '@/components/Contact'
import About from '@/components/About'

import Alice from '@/components/viewsss/Alice'
import AllContacts from '@/components/viewsss/AllContacts'
import Bob from '@/components/viewsss/Bob'

import Blog from '@/components/viewsss/bobfax/Blog'
import Fax from '@/components/viewsss/bobfax/Fax'



// 面经
import ArticleDetail from '@/components/ArticleDetail'
import Article from '@/components/Article'
import Layout from '@/components/Layout'
import Like from '@/components/Like'
import User from '@/components/User'
import Collect from '@/components/Collect'


import VueRouter from 'vue-router'
// 在vue中，使用使用vue的插件，都需要调用Vue.use()
Vue.use(VueRouter)
const router = new VueRouter({
    routes:[
        {
            path:'/',
            redirect: '/home'
        },
        {
            path:'/home',
            component:Home
        },
        {
            path:'/news',
            component:News
        },
        {
            path:'/tiyu',
            component:TiYu,
            children:[
                {
                    path:'guonei',
                    component:GuoNei
                }, {
                    path:'waiguo',
                    component:WaiGuo
                },
                {
                    path:'tizhu',
                    component:TiZhu
                }
            ]
        },

        // 作业二
        {
            path:'/',
            redirect: '/uirouter'
        },
        {
            path:'/uirouter',
            component:UiRouter
        },
        {
            path:'/contact',
            component:Contact,
            children:[
                {
                    path:'alice',
                    component:Alice
                },
                {
                    path:'allcontacts',
                    component:AllContacts
                },
                {
                    path:'bob',
                    component:Bob,
                    children:[
                        {
                            path:'blog',
                            component:Blog
                        },
                        {
                            path:'fax',
                            component:Fax
                        }
                    ]
                },
            ]
        },
        {
            path:'/about',
            component:About
        },


        
        
        // 11.8面经
        {
            path:'/',
            component:Layout,
            //二级路由。写法与一级路由相同，三级同样。路径加上前面的路径
            children:[
              {
                path:'/article',
                component:Article
              },
              {
                path:'/collect',
                component:Collect
              },
              {
                path:'/like',
                component:Like ,
              },
              {
                path:'/user',
                component:User
              }
            ]
          },
          {
            path:'/detail/:id',
            component:ArticleDetail
          }
    ]
})
export default router